<!--
 * @Descripttion: 文件说明
 * @version: V1.0
 * @Author: GW
 * @Date: 2021-07-29 10:40:40
 * @LastEditors: GW
 * @LastEditTime: 2022-01-13 14:09:26
-->
<template>
    <div class="form-group FormDataPicker" style="margin-bottom:0px;">
        <label :class="labelClass" :style="finalLabelStype"><span v-if="required" class="required ">*</span>{{ title }}：</label>
        <div :class="rightClass" :style="rightStyle">
            <form-pop :content="error" />
            <a-date-picker :title="value" :value="value" :showTime="showTime" :format="format" :disabled-date="disabledDate" :placeholder="placeholder" @change="onChange" />
        </div>
    </div>
</template>

<script>
import formAttr from "@/mixins/form/form-attr";

const defaultLabelStype =
    "font-weight: normal;justify-content: flex-end;padding-left: 5px;text-align: right;width:110px;";
export default {
    name: "FromDatePicker",
    mixins: [formAttr],
    props: {
        disabledDate: {
            type: Function,
            default: null
        },
        placeholder: {
            type: String,
            default: ""
        },
        format: {
            type: String,
            default: ""
        },
        showTime: {
            type: [Object, Boolean],
            default: false
        }
    },

    computed: {
        finalLabelStype: function () {
            return this.labelStyle || defaultLabelStype;
        },
    },
    methods: {
        onChange (date, dateString) {
            this.$emit("input", dateString);
            this.$emit("update:momentDate", date);
        }
    }
};
</script>
<style lang="less">
    .FormDataPicker {
        .ant-calendar-picker {
            min-width: 100% !important;
        }
    }
</style>
